﻿<%@ Page Title="" Language="C#" MasterPageFile="~/OrderManagement.master" AutoEventWireup="true"
    CodeBehind="CreateOrder.aspx.cs" Inherits="SCFHS.Views.CreateOrder" %>

<asp:Content ID="Content1" ContentPlaceHolderID="NastedHead" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#CreateOrder").addClass("createOrderMenuactive");
        });
        function OpenFile(ths) {
            var Filename = '<%= ResolveUrl(ConfigurationManager.AppSettings["UploadPath"].ToString()) %>';
            if (document.all) {
                Filename = Filename + '/' + ths.innerText;
            } else {
                Filename = Filename + '/' + ths.textContent;
            }
            window.open(Filename, '_blank');
            return false;
        }

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="NastedBody" runat="server">
    <asp:HiddenField ID="hdfNewCreatedID" runat="server" />
    <asp:Label Text=" " runat="server" ID="lblMessage" class="info" />
    <asp:MultiView ActiveViewIndex="0" runat="server" ID="mView">
        <asp:View runat="server" ID="vMainInfo">
            <div id="MainInfo" class="Box radius">
                <div class="BoxTitle radius">
                    البيانات الأساسية
                </div>
                <div class="MainInfoContent">
                    <div class="row">
                        <ul class="title">
                            <li>الإسم</li>
                        </ul>
                        <ul class="data">
                            <li>
                                <asp:TextBox runat="server" Width="265px" Font-Size="20px" TabIndex="1" ID="txtPersonName"
                                    MaxLength="80" EnableViewState="true" /><asp:RequiredFieldValidator ID="RequiredFieldValidator3"
                                        ErrorMessage="يجب إدخال إسم صاحب الطلب اولا" ControlToValidate="txtPersonName"
                                        runat="server" Text="*" ValidationGroup="OrderMainDetails" ForeColor="Red" /></li>
                        </ul>
                    </div>
                    <div class="row">
                        <ul class="title">
                            <li>الرقم</li>
                        </ul>
                        <ul class="data">
                            <li>
                                <asp:TextBox ID="txtOrderNo" runat="server" Width="100px" TabIndex="2" MaxLength="20"
                                    CssClass="ltrNumbers" /><asp:RequiredFieldValidator ID="RequiredFieldValidator1"
                                        ErrorMessage="يجب إدخال رقم الطلب اولا" ControlToValidate="txtOrderNo" runat="server"
                                        Text="*" ValidationGroup="OrderMainDetails" ForeColor="Red" /></li>
                        </ul>
                        <ul class="title">
                            <li>التاريخ</li>
                        </ul>
                        <ul class="data">
                            <li>
                                <asp:TextBox ID="txtDate" runat="server" Width="100px" TabIndex="3" class="date"
                                    MaxLength="12" /></li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="ProgressContent">
                <asp:Button Text="حفظ الطلب" runat="server" Font-Size="16" ID="btnCreateOrder" OnClick="btnCreateOrder_Click"
                    TabIndex="4" ValidationGroup="OrderMainDetails" CssClass="button" />
                <asp:Button Text="إنشاء الطلب" runat="server" Font-Size="16" ID="btnSave" OnClick="btnSaveOrder_Click"
                    Visible="false" CssClass="button" />
                <asp:Button Text="إستكمال الطلب" runat="server" Font-Size="16" ID="btnProced" OnClick="btnProced_Click"
                    Visible="false" CssClass="button" />
            </div>
        </asp:View>
        <asp:View runat="server" ID="vAttachments">
            <div class="Box radius-Bottom">
                <div class="ContentTitle">
                    المرفقات
                </div>
                <div class="row AttachContent">
                    <div class="row">
                        <asp:Label Text=" " runat="server" ID="lblUploadMessage" class="info" />
                    </div>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always" RenderMode="Inline">
                        <ContentTemplate>
                            <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"
                                DisplayAfter="1">
                                <ProgressTemplate>
                                    <div style="position: absolute; z-index: 100; background-color: Gray; color: White;">
                                        جاري تنفيذ العملية يرجي الإنتظار قليلاً ....
                                    </div>
                                </ProgressTemplate>
                            </asp:UpdateProgress>
                            <div id="AttachContent" class="row">
                                <div class="row">
                                    <div id="AttachItem" class="row" style="padding-right: 0; width: 100%">
                                        <div>
                                            <asp:FileUpload runat="server" ID="fuAttach" Width="341" Height="30" EnableViewState="false" /><asp:RequiredFieldValidator
                                                ErrorMessage="يجب تحديد ملف اولا" ControlToValidate="fuAttach" runat="server"
                                                Text="*" ForeColor="Red" ValidationGroup="upload" />
                                        </div>
                                        &nbsp;
                                        <div>
                                            <asp:Button Text="رفع" runat="server" ID="btnUpload" OnClick="btnUpload_Click" Width="80"
                                                CssClass="button" ValidationGroup="upload" />
                                        </div>
                                    </div>
                                    <div class="row">
                                        <asp:GridView runat="server" ID="grdAttachmentFiles" AutoGenerateColumns="False"
                                            CellPadding="4" ForeColor="#333333" GridLines="Both" BorderWidth="2" DataKeyNames="ID"
                                            OnRowDeleting="grdAttachmentFiles_RowDeleting" OnRowDataBound="grdAttachmentFiles_RowDataBound">
                                            <AlternatingRowStyle BackColor="White" />
                                            <Columns>
                                                <asp:TemplateField HeaderText="م">
                                                    <ItemTemplate>
                                                        <div style="width: 19px; text-align: center">
                                                            <%#Container.DataItemIndex+1 %>
                                                        </div>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="الملفـــات">
                                                    <ItemTemplate>
                                                        <asp:LinkButton ID="lblAttachmentPoint" Text='<%# Eval("AttachmentPath")%>' runat="server"
                                                            Width="300" OnClientClick="return OpenFile(this)"></asp:LinkButton>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:CommandField ShowDeleteButton="true" DeleteText="حذف" ControlStyle-Width="80">
                                                    <ControlStyle Width="80px" />
                                                </asp:CommandField>
                                            </Columns>
                                            <EditRowStyle BackColor="#2461BF" />
                                            <EmptyDataTemplate>
                                                <asp:Label ID="Label1" Text=" لم يتم رفع مرفقات للطلب" runat="server" Width="600px" />
                                            </EmptyDataTemplate>
                                            <EmptyDataRowStyle ForeColor="Black" Font-Bold="true" BorderStyle="None" />
                                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                            <HeaderStyle BackColor="#056796" Font-Bold="True" ForeColor="White" />
                                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                            <RowStyle BackColor="#EFF3FB" />
                                            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                            <SortedAscendingCellStyle BackColor="#F5F7FB" />
                                            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                                            <SortedDescendingCellStyle BackColor="#E9EBEF" />
                                            <SortedDescendingHeaderStyle BackColor="#4870BE" />
                                        </asp:GridView>
                                    </div>
                                </div>
                            </div>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
            </div>
            <div class="ProgressContent update">
                <asp:Button Text="تعديل بيانات الطلب" runat="server" ID="btnUpdateOrder" OnClick="btnUpdateOrder_Click"
                    CssClass="button" />
                <asp:Button Text="إنشاء الطلب" runat="server" CssClass="button" ID="btnSaveOrder"
                    OnClick="btnSaveOrder_Click" />
            </div>
        </asp:View>
    </asp:MultiView>
</asp:Content>
